package com.myhome.config;

import cn.hutool.core.lang.Snowflake;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author QYiXin
 * @Date 2021 10 25 21 02
 **/
@Configuration
public class SnowflakeConfig {
    @Value("${workId:1}")
    private Long workId;
    @Value("${appId:1}")
    private Long appId;
    @Bean
    public Snowflake getSnowflake() {
        return new Snowflake(workId, appId);
    }
}
